package com.usaas.search.controller.admin;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import com.usaas.common.core.controller.BaseController;
import com.usaas.common.core.domain.AjaxResult;
import com.usaas.common.enums.BusinessType;
import com.usaas.common.utils.poi.ExcelUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.usaas.common.annotation.Log;
import com.usaas.search.dto.PlatMessageCommentsDto;
import com.usaas.search.service.IPlatMessageCommentsService;
/**
 * 平台推广信息—留言Controller
 *
 * @author Helios
 * @date 2024-08-14
 */
@RestController
@RequestMapping("/admin/search/platMessageComments")
public class AdminPlatMessageCommentsController extends BaseController {

    @Autowired
    private IPlatMessageCommentsService platMessageCommentsService;

    /**
     * 查询平台推广信息—留言列表
     */
    @PreAuthorize("@ss.hasPermi('search:platMessageComments:list')")
    @Log(title = "管理端平台推广信息—留言list查询", businessType = BusinessType.OTHER)
    @PostMapping("/list")
    public AjaxResult list(@RequestBody PlatMessageCommentsDto platMessageCommentsDto) {
        List<PlatMessageCommentsDto> list = platMessageCommentsService.queryList(platMessageCommentsDto);
        return AjaxResult.success(list);
    }


    /**
     * 查询平台推广信息—留言分页列表
     */
    @PreAuthorize("@ss.hasPermi('search:platMessageComments:list')")
    @Log(title = "管理端平台推广信息—留言page查询", businessType = BusinessType.OTHER)
    @PostMapping("/page")
    public AjaxResult page(@RequestBody PlatMessageCommentsDto platMessageCommentsDto) {
        return platMessageCommentsService.queryPage(platMessageCommentsDto);
    }


    /**
     * 导出平台推广信息—留言列表
     */
    @PreAuthorize("@ss.hasPermi('search:platMessageComments:export')")
    @Log(title = "管理端导出平台推广信息—留言", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response,PlatMessageCommentsDto platMessageCommentsDto) {
        List<PlatMessageCommentsDto> list = platMessageCommentsService.queryList(platMessageCommentsDto);
        ExcelUtil<PlatMessageCommentsDto> util = new ExcelUtil<>(PlatMessageCommentsDto.class);
        util.exportExcel(response, list, "平台推广信息—留言数据");
    }

    /**
     * 获取平台推广信息—留言详细信息
     */
    @PreAuthorize("@ss.hasPermi('search:platMessageComments:query')")
    @Log(title = "管理端获取平台推广信息—留言详情查询", businessType = BusinessType.OTHER)
    @PostMapping(value = "/getInfo")
    public AjaxResult getInfo(@RequestBody PlatMessageCommentsDto platMessageCommentsDto) {
        return AjaxResult.success(platMessageCommentsService.queryById(platMessageCommentsDto.getId()));
    }

    /**
     * 新增平台推广信息—留言
     */
    @PreAuthorize("@ss.hasPermi('search:platMessageComments:add')")
    @Log(title = "管理端新增平台推广信息—留言", businessType = BusinessType.INSERT)
    @PostMapping(value = "/add")
    public AjaxResult add(@RequestBody PlatMessageCommentsDto platMessageCommentsDto) {
        return toAjax(platMessageCommentsService.add(platMessageCommentsDto));
    }

    /**
     * 修改平台推广信息—留言
     */
    @PreAuthorize("@ss.hasPermi('search:platMessageComments:edit')")
    @Log(title = "管理端修改平台推广信息—留言", businessType = BusinessType.UPDATE)
    @PostMapping(value = "/edit")
    public AjaxResult edit(@RequestBody PlatMessageCommentsDto platMessageCommentsDto) {
        return toAjax(platMessageCommentsService.update(platMessageCommentsDto));
    }

    /**
     * 删除平台推广信息—留言
     */
    @PreAuthorize("@ss.hasPermi('search:platMessageComments:remove')")
    @Log(title = "管理端删除平台推广信息—留言", businessType = BusinessType.DELETE)
    @PostMapping("/del")
    public AjaxResult del(@RequestBody PlatMessageCommentsDto platMessageCommentsDto) {
        return toAjax(platMessageCommentsService.removeBatch(platMessageCommentsDto.getIds()));
    }

}
